// pages/album/album.js
const { Data } = require("../../utils/data");
Page({

  data: {

  },

  onLoad: async function (options) {
    var id = options.id;
    var module = await import("../../utils/http");
    var res = await module.Url.detailUrl(id);
    var album = this.handleData(res.data.playlist);
    this.setData({ album })
  },
  handleData(res) {
    res.playCount = Data.HandlePlayCount(res.playCount);
    res.tracks.forEach(item => {
      item.dt = Data.HandleDuration(item.dt);
      item.artistName = item.ar[0].name;
    })
    return res
  },
  toSong(event) {
    var id = event.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/song/song?id=${id}`,
    })
  }
})